//
//  FLSCentreViewController.m
//  FeeLing
//
//  Created by 乔光玉 on 2019/1/4.
//  Copyright © 2019年 大仙儿飘. All rights reserved.
//
#import "FLUseofTermsViewController.h"
#import "FLPrivacypolicyViewController.h"
#import "FLUseragreementViewController.h"
#import "FLSameTwoTableViewCell.h"
#import "FLSameOneTableViewCell.h"
#import "FLSCentreViewController.h"

@interface FLSCentreViewController ()<UITableViewDelegate, UITableViewDataSource,UINavigationControllerDelegate>
@property(nonatomic,strong)UITableView * personalTableView;

@end

@implementation FLSCentreViewController
-(void)backclick{
    
    [self.navigationController popViewControllerAnimated:YES];
    
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor colorWithHexString:@"#2B2D5C"];
    [self.navigationController setNavigationBarHidden:YES animated:YES];
    UIView *navview = [[UIView alloc] init];
    navview.frame = CGRectMake(0,0,SCREENWIDTH,64);
    
    navview.backgroundColor = [UIColor colorWithHexString:@"32346A"];
    [self.view addSubview:navview];
    UILabel *label = [[UILabel alloc] init];
    label.frame = CGRectMake(0,30,SCREENWIDTH,25);
    label.text = NSLocalizedString(@"guanyuwomen", nil);
    label.font = [UIFont fontWithName:@"PingFangSC-Regular" size:18];
    label.textColor = [UIColor colorWithHexString:@"#FFFFFF"];
    label.textAlignment = NSTextAlignmentCenter;
    label.alpha = 1;
    label.numberOfLines = 0;
    [self.view addSubview:label];
    
    UIButton * back = [UIButton new];
    [back setImage:[UIImage imageNamed:@"返回首页_slices"] forState:UIControlStateNormal];
    back.frame = CGRectMake(12, 27, 30, 30);
    [back addTarget:self action:@selector(backclick) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:back];
    
    _personalTableView = [[UITableView alloc] initWithFrame:CGRectMake(0,84, self.view.frame.size.width, SCREENHEIGHT-84) style:UITableViewStylePlain];
    if (SCREENHEIGHT>800) {
        navview.frame = CGRectMake(0,0,SCREENWIDTH,64+20);
        label.frame = CGRectMake(0,30+20,SCREENWIDTH,25);
        back.frame = CGRectMake(12, 27+20, 30, 30);
        _personalTableView.frame =CGRectMake(0,84+20, self.view.frame.size.width, SCREENHEIGHT-84-20);
    }
    _personalTableView.dataSource = self;
    _personalTableView.delegate = self;
    _personalTableView.backgroundColor =  [UIColor colorWithHexString:@"#2B2D5C"];
    [_personalTableView setSeparatorColor:[UIColor clearColor]];
    _personalTableView.separatorStyle = UITableViewCellEditingStyleNone;
    [self.view addSubview:_personalTableView];
    
}
#pragma mark -- UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 2;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    
        
        FLSameOneTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"FLSameOneTableViewCell"];
       
        if (!cell) {
            cell = [[FLSameOneTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"FLSameOneTableViewCell"];
            
            
        }
         cell.selectionStyle = UITableViewCellSelectionStyleNone;
        if (indexPath.row==0) {
            UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:cell.bottom.bounds byRoundingCorners:UIRectCornerTopLeft  |UIRectCornerTopRight  cornerRadii:CGSizeMake(5,5)];
            
            //创建 layer
            CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
            maskLayer.frame = cell.bottom.bounds;
            //赋值
            maskLayer.path = maskPath.CGPath;
            cell.bottom.layer.mask = maskLayer;
            cell.titlelabel.text = NSLocalizedString(@"yinsizhengce", nil);
            
            
        }else{
            UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:cell.bottom.bounds byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight  cornerRadii:CGSizeMake(5,5)];
            
            //创建 layer
            CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
            maskLayer.frame = cell.bottom.bounds;
            //赋值
            maskLayer.path = maskPath.CGPath;
            cell.bottom.layer.mask = maskLayer;
            cell.titlelabel.text = NSLocalizedString(@"yonghuxieyi", nil);
            cell.line.hidden = YES;
            
        }
        
        
        
        
        
        
        return cell;
        
  
    
    
    
    
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
   
        return 70;
    
    
}


-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    self.hidesBottomBarWhenPushed=YES;
    if (indexPath.row==0) {
        FLPrivacypolicyViewController * vc = [[FLPrivacypolicyViewController alloc]init];
        [self.navigationController pushViewController:vc animated:YES];
        
        
    }else if (indexPath.row==1) {
        FLUseofTermsViewController * vc = [[FLUseofTermsViewController alloc]init];
        [self.navigationController pushViewController:vc animated:YES];
        
    }
    
    
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
